<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Admin</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="../admin/vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../admin/vendor/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../admin/css/fontastic.css">
    <link rel="stylesheet" href="../admin/css/style.default.css" id="theme-stylesheet">
    <link rel="stylesheet" href="../admin/css/custom.css">
    <link rel="stylesheet" href="../tools/layui/css/layui.css">
</head>
<body>
<div class="page">
    <div>
        <!--头部导航-->
        <div th:replace="admin/common/com-template::admin_topslide"/>
        <div class="page-content d-flex align-items-stretch">
            <!--左侧导航-->
            <!--左侧导航栏-->
            <nav class="side-navbar" th:fragment="admin_leftslide">
                <div th:replace="admin/common/com-template::admin_avatar"/>
                <!-- Sidebar Navidation Menus-->
                <span class="heading">Main</span>
                <ul class="list-unstyled">
                    <li><a href="/admin"> <i class="layui-icon icon-home"></i>主页 </a>
                    </li>
                    <li><a href="/admin/blog"> <i class="layui-icon layui-icon-template"></i>博客管理</a></li>
                    <li class="active"><a href="/admin/jumpBlog"> <i class="layui-icon layui-icon-release"></i>博客发布</a>
                    </li>
                    <li><a href="/admin/category"> <i class="layui-icon layui-icon-note"></i>分类管理</a></li>
                    <li><a href="/admin/label"> <i class="layui-icon layui-icon-note"></i>标签管理</a></li>
                    <li><a href="#exampledropdownDropdown" aria-expanded="false" data-toggle="collapse">
                        <i class="layui-icon layui-icon-user"></i>用户管理</a>
                        <ul id="exampledropdownDropdown" class="collapse list-unstyled">
                            <li><a href="#">用户列表</a></li>
                            <li><a href="#">授权</a></li>
                        </ul>
                    </li>
                </ul>
                <span class="heading">Extras</span>
                <ul class="list-unstyled">
                    <li><a href="#"> <i class="icon-picture"></i>首图管理</a></li>
                </ul>
            </nav>
            <!--内容-->
            <div class="content-inner" id="middle_show">
                <div>
                    <!-- Page Header-->
                    <header class="page-header">
                        <div class="container-fluid">
                            <h2 class="no-margin-bottom" th:text="${pojo==null} ?'博客发布' : '博客编辑'">博客发布</h2>
                        </div>
                    </header>
                    <!--表单-->
                    <section class="tables" style="padding-top: 30px">
                        <div class="container-fluid">
                            <div class="row">
                                <!-- Basic Form-->
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header d-flex align-items-center">
                                            <p th:text="${pojo==null} ?'博客发布' : '博客编辑'">博客发布</p>
                                        </div>
                                        <div class="card-body">
                                            <form id="blog-form">
                                                <input type="hidden" name="id"
                                                       th:value="${pojo!=null} ? ${pojo.id} : ''">
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>博客标题</strong></label>
                                                    <input type="text" name="title" placeholder="请输入标题"
                                                           class="form-control" required
                                                           th:value="${pojo!=null} ? ${pojo.title} : ''">
                                                </div>
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>博客分类</strong></label>
                                                    <select class="form-control" name="categoryId">
                                                        <option th:each="category:${categoryList}"
                                                                th:value="${category.id}"
                                                                th:text="${category.name}"
                                                                th:if="${pojo==null}">

                                                        <option th:each="category:${categoryList}"
                                                                th:value="${category.id}"
                                                                th:text="${category.name}"
                                                                th:selected="${category.id} == ${pojo.category.id}"
                                                                th:if="${pojo!=null}">
                                                        </option>
                                                    </select>
                                                </div>
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>博客内容</strong></label>
                                                    <div id="test-editormd">
                                        <textarea style="display:none;" name="content"
                                                  th:text="${pojo!=null} ? ${pojo.content} : ''" required></textarea>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>博客首图</strong></label>
                                                    <input type="text" placeholder="请填写图片地址"
                                                           class="form-control" required name="firstPicture"
                                                           th:value="${pojo!=null} ? ${pojo.firstPicture} : ''">
                                                </div>
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>博客描述</strong></label>
                                                    <textarea type="text" placeholder="请填写博客描述"
                                                              class="form-control" name="description" required
                                                              th:text="${pojo!=null} ? ${pojo.description} : ''"></textarea>
                                                </div>
                                                <div class="form-group">
                                                    <label class="form-control-label"><strong>标签</strong></label>
                                                    <input type="text" placeholder="标签"
                                                           class="form-control" name="labelName" required
                                                           th:value="${pojo!=null} ? ${pojo.labels} : ''">
                                                </div>
                                                <div class="form-group">
                                                    <input onclick="history.go(-1)" type="button" value="返回"
                                                           class="btn">
                                                    <input type="button" value="草稿" class="btn btn-warning">
                                                    <input type="button" value="发布"
                                                           class="btn btn-primary blog-submit-btn">
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                    <!-- Page Footer-->
                    <div th:replace="admin/common/com-template::admin_footer"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../admin/vendor/jquery/jquery.min.js"></script>
<script src="../admin/vendor/popper.js/umd/popper.min.js"></script>
<script src="../admin/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="../admin/vendor/jquery.cookie/jquery.cookie.js"></script>
<script src="../admin/vendor/jquery.cookie/jquery.cookie.js"></script>
<script src="../tools/layui/layui.js"></script>
<script src="../../admin/js/html5shiv.min.js"></script>
<script src="../../admin/js/respond.min.js"></script>
<!--resource-->
<link rel="stylesheet" href="../tools/editor-md/css/editormd.css"/>
<script src="../tools/editor-md/js/editormd.min.js"></script>
<script type="text/javascript">
    //editor
    var editormd;

    $(function () {
        testEditor = editormd("test-editormd", {
            width: "100%",
            height: 500,
            syncScrolling: "single",
            path: "../tools/editor-md/lib/",
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL: "/admin/upload"
        });
    });
</script>
<!--控制-->
<script src="../admin/controller.js"></script>
</body>
</html>